#include "..\headers\ListOf.h"

#define Unusual -9999

float pop(float stack[], int &top) {
  if (top < 0) {
    return Unusual;
  }
  float e = stack[top - 1];
  stack[top - 1] = 0;
  top--;
  return e;
}

float Calulater(char polynomial[]) {
  long left, right;  // traverse from right to left
  float stacknum[90] = {0};
  int top = 0;
  long flag = 1;
  for (int i = strlen(polynomial) - 1; i >= 0; i--) {
    if (polynomial[i] == ' ') {
      flag = 1;
      continue;
    }
    if (polynomial[i] >= '0' && polynomial[i] <= '9') {
      if (flag == 1) stacknum[top] = polynomial[i] - '0';
      if (flag > 1) {
        top--;
        stacknum[top] = stacknum[top] + (polynomial[i] - '0') * flag;
      }
      flag = flag * 10;
      top++;
      continue;
    }
    if (polynomial[i] == '+') {
      // pop two elem
      left = pop(stacknum, top);
      right = pop(stacknum, top);
      if (left == Unusual || right == Unusual) {
        return Unusual;
      }
      stacknum[top++] = left + right;
      continue;
    }
    if (polynomial[i] == '-') {
      // pop two elem
      left = pop(stacknum, top);
      right = pop(stacknum, top);
      if (left == Unusual || right == Unusual) {
        return Unusual;
      }
      stacknum[top++] = left - right;
      continue;
    }
    if (polynomial[i] == '*') {
      // pop two elem
      left = pop(stacknum, top);
      right = pop(stacknum, top);
      if (left == Unusual || right == Unusual) {
        return Unusual;
      }
      stacknum[top++] = left * right;
      continue;
    }
    if (polynomial[i] == '/') {
      // pop two elem
      left = pop(stacknum, top);
      right = pop(stacknum, top);
      if (left == Unusual || right == Unusual || right == 0) {
        return Unusual;
      }
      stacknum[top++] = (float)left / (float)right;
      continue;
    }
    if (polynomial[i] != '\n') return Unusual;
  }  // end for
  if (stacknum[1] != 0) return Unusual;
  return stacknum[0];
}

int main() {
  char polynomial[91] = {'\0'};
  int i = 0;
  while (polynomial[i - 1] != '\n') scanf("%c", &polynomial[i++]);

  if (polynomial[0] == '\n') {
    printf("ERROR");
    return 0;
  }

  // traverse and push
  float result = Calulater(polynomial);
  if (result == Unusual) {
    printf("ERROR");
    return 0;
  }
  printf("%.1f", result);
  return 0;
}
